<?php
ini_set('display_errors', 1); 
ini_set('error_reporting', 'E_error'); 
$handling_time_id=$_REQUEST['handling_time_id'];

if(isset($_REQUEST['CategoryKey']))
 {
	$catName=$_REQUEST['cat_name'];		
	$catDescription=$_REQUEST['cat_description'];
	$today=date("Y-m-d");		
	//$sql_addcat="Update tbl_shipping_handling_time set shipping_name='$catName',shipping_description='$catDescription' where shipping_id=$handling_time_id";
	//$rst_addcat=mysql_query($sql_addcat) or die(mysql_error());
		
	if($handling_time_id==0)
	{
	
		$sql_addcat="insert tbl_handling_time set handling_time_name='$catName',handling_time_description='$catDescription' ";
		$rst_addcat=mysql_query($sql_addcat) or die(mysql_error());
		header("Location: ". "index.php?list_handling_time");
	}
	else
	{
		$sql_addcat="Update tbl_handling_time set handling_time_name='$catName',handling_time_description='$catDescription' where handling_time_id=$handling_time_id";
		$rst_addcat=mysql_query($sql_addcat) or die(mysql_error());
	}
	$msgEditScat="Handling Time Edited Successfully";
	
 }
 if($handling_time_id==0)
 {
 	$task="Add";
 }
 else
 {
 	$task="Edit";
 }
 
$sqlSelEditSubcategory="select * from tbl_handling_time where handling_time_id=$handling_time_id";
$rstSelEditSubcategory=mysql_query($sqlSelEditSubcategory);
$rowSelEditSubcategory=mysql_fetch_array($rstSelEditSubcategory);
$subcategoryEditName=$rowSelEditSubcategory['handling_time_name'];
$subcategoryEditDescription=$rowSelEditSubcategory['handling_time_description'];
 
?>
<table width="100%"  border="1" cellspacing="0" class="container">
  <tr>
    <td width="469" height="25" class="tdHeader"><?php echo $task;?> Handling Time<span style="text-align:right; padding-left:350px;"><input type='button' name='addsscat' value='Back' class='button' onClick="window.location='index.php?list_handling_time'"  /></span></td>
  </tr>
  <tr>
    <td>	
          <form action="" method="post" name="formEditSubCat" id="formEditSubCat">
		  <input type="hidden" name="CategoryKey" id="CategoryKey">
           <table width="423" border="0" cellspacing="0" align="center">
          <tr>
            <td height="40" colspan="3"><div align="center"><?php echo "<b>".$msgEditScat."</b>"; ?></div></td>
            
          </tr>
		 
		  <tr>
		  	<td colspan="3">&nbsp;</td>
		  </tr>
          <tr>
            <td height="29">&nbsp;</td>
            <td><div align="left">Name </div></td>
            <td>
              <div align="left">
                <input type="text" name="cat_name" id="cat_name" value="<?php echo $subcategoryEditName; ?>">
              </div></td>
          </tr>
		   <tr>
            <td height="31">&nbsp;</td>
            <td>Description </td>
            <td><textarea name="cat_description" id="cat_description"><?php echo $subcategoryEditDescription; ?></textarea></td>
           </tr>		  
		  <tr>
            <td height="65" colspan="3"><div align="center">
                <input name="Submit" type="button" value="<?php echo $task;?> Handling Time" class="button" onClick="editServices()">
              </div></td>
         </tr>
        </table>
       </form>
     </td>
  </tr>
</table>

